package com.alliky.classify.ui.adapter

import androidx.core.content.ContextCompat
import com.alliky.classify.R
import com.rrc.common.entity.CategoryVO
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder

/**
 * ================================================
 * @Description: 描述
 * @Author: wxianing
 * @Date: 2023/1/17 17:07
 * ================================================
 */
class ClassifyTitleAdapter(data: ArrayList<CategoryVO>?) :
    BaseQuickAdapter<CategoryVO, BaseViewHolder>(R.layout.item_category_left_layout, data) {
    override fun convert(helper: BaseViewHolder, item: CategoryVO?) {
        helper.addOnClickListener(R.id.tv_title)
        helper.setText(R.id.tv_title, item?.cate_name)
        if (item!!.selected) {
            helper.setBackgroundRes(R.id.tv_title, R.color.white)
            helper.setTextColor(
                R.id.tv_title,
                ContextCompat.getColor(mContext, R.color.deepskyblue)
            )
        } else {
            helper.setBackgroundRes(R.id.tv_title, R.color.transparent)
            helper.setTextColor(
                R.id.tv_title,
                ContextCompat.getColor(mContext, R.color.default_black)
            )
        }
    }
}